package com.ly.heart.service.impl;

import java.util.List;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import org.springframework.stereotype.Service;
import com.ly.heart.mapper.ProjectUserMapper;
import com.ly.heart.domain.ProjectUserEntity;
import com.ly.heart.service.IProjectUserService;

import javax.annotation.Resource;

/**
 * 项目成员关联关系Service业务层处理
 *
 * @author cxl
 * @date 2024-05-14
 */
@Service
public class ProjectUserServiceImpl implements IProjectUserService {

    @Resource
    private ProjectUserMapper projectUserMapper;

    /**
     * 查询项目成员关联关系
     *
     * @param id 项目成员关联关系主键
     * @return 项目成员关联关系
     */
    @Override
    public ProjectUserEntity selectProjectUserEntityById ( String id ) {
        return projectUserMapper.selectProjectUserEntityById ( id );
    }

    /**
     * 查询项目成员关联关系列表
     *
     * @param projectUserEntity 项目成员关联关系
     * @return 项目成员关联关系
     */
    @Override
    public List<ProjectUserEntity> selectProjectUserEntityList ( ProjectUserEntity projectUserEntity ) {
        return projectUserMapper.selectProjectUserEntityList ( projectUserEntity );
    }

    /**
     * 新增项目成员关联关系
     *
     * @param projectUserEntity 项目成员关联关系
     * @return 结果
     */
    @Override
    public int insertProjectUserEntity ( ProjectUserEntity projectUserEntity ) {
        projectUserEntity.setId ( SnowflakeIdWorker.getInstance ().nextStringId () );
        projectUserEntity.setCreateTime ( DateUtils.getNowDate () );
        return projectUserMapper.insertProjectUserEntity ( projectUserEntity );
    }

    /**
     * 修改项目成员关联关系
     *
     * @param projectUserEntity 项目成员关联关系
     * @return 结果
     */
    @Override
    public int updateProjectUserEntity ( ProjectUserEntity projectUserEntity ) {
        return projectUserMapper.updateProjectUserEntity ( projectUserEntity );
    }

    /**
     * 批量删除项目成员关联关系
     *
     * @param ids 需要删除的项目成员关联关系主键
     * @return 结果
     */
    @Override
    public int deleteProjectUserEntityByIds ( String[] ids ) {
        return projectUserMapper.deleteProjectUserEntityByIds ( ids );
    }

    /**
     * 删除项目成员关联关系信息
     *
     * @param id 项目成员关联关系主键
     * @return 结果
     */
    @Override
    public int deleteProjectUserEntityById ( String id ) {
        return projectUserMapper.deleteProjectUserEntityById ( id );
    }
}
